﻿/**  PACS v1.0
* YW_ReportInfo.cs
*
* 类 名： YW_ReportInfo
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2018/6/5 15:24:40   douwd    初版
*
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Pacs.DAL
{
	/// <summary>
	/// 数据访问类:YW_ReportInfo
	/// </summary>
	public partial class YW_ReportInfo
	{
		public YW_ReportInfo()
		{}
		#region  Method


		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from YW_ReportInfo");
			strSql.Append(" where ID='"+ID+"' ");
			return DbHelperSQL.Exists(strSql.ToString());
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(Pacs.Model.YW_ReportInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
			if (model.ID != null)
			{
				strSql1.Append("ID,");
				strSql2.Append("'"+model.ID+"',");
			}
			if (model.YX_StudyInfoID != null)
			{
				strSql1.Append("YX_StudyInfoID,");
				strSql2.Append("'"+model.YX_StudyInfoID+"',");
			}
			if (model.BaoGaoMingCheng != null)
			{
				strSql1.Append("BaoGaoMingCheng,");
				strSql2.Append("'"+model.BaoGaoMingCheng+"',");
			}
			if (model.YouXiaoShiJian != null)
			{
				strSql1.Append("YouXiaoShiJian,");
				strSql2.Append("'"+model.YouXiaoShiJian+"',");
			}
			if (model.TuPianMiaoShu != null)
			{
				strSql1.Append("TuPianMiaoShu,");
				strSql2.Append("'"+model.TuPianMiaoShu+"',");
			}
			if (model.JianChaSuoJian != null)
			{
				strSql1.Append("JianChaSuoJian,");
				strSql2.Append("'"+model.JianChaSuoJian+"',");
			}
			if (model.BaoGaoYiShengID != null)
			{
				strSql1.Append("BaoGaoYiShengID,");
				strSql2.Append("'"+model.BaoGaoYiShengID+"',");
			}
			if (model.BaoGaoYiShengXingMing != null)
			{
				strSql1.Append("BaoGaoYiShengXingMing,");
				strSql2.Append("'"+model.BaoGaoYiShengXingMing+"',");
			}
			if (model.BaoGaoYiShengNO != null)
			{
				strSql1.Append("BaoGaoYiShengNO,");
				strSql2.Append("'"+model.BaoGaoYiShengNO+"',");
			}
			if (model.BaoGaoYiShengQianMing != null)
			{
				strSql1.Append("BaoGaoYiShengQianMing,");
				strSql2.Append(""+model.BaoGaoYiShengQianMing+",");
			}
			if (model.BaoGaoZhuangTai != null)
			{
				strSql1.Append("BaoGaoZhuangTai,");
				strSql2.Append("'"+model.BaoGaoZhuangTai+"',");
			}
			if (model.ChuangJianShiJian != null)
			{
				strSql1.Append("ChuangJianShiJian,");
				strSql2.Append("'"+model.ChuangJianShiJian+"',");
			}
			if (model.ChuangJianRen != null)
			{
				strSql1.Append("ChuangJianRen,");
				strSql2.Append("'"+model.ChuangJianRen+"',");
			}
			if (model.ChuangJianRenID != null)
			{
				strSql1.Append("ChuangJianRenID,");
				strSql2.Append("'"+model.ChuangJianRenID+"',");
			}
			if (model.ChuangJianRenNO != null)
			{
				strSql1.Append("ChuangJianRenNO,");
				strSql2.Append("'"+model.ChuangJianRenNO+"',");
			}
			if (model.JianChaXiangMuNO != null)
			{
				strSql1.Append("JianChaXiangMuNO,");
				strSql2.Append("'"+model.JianChaXiangMuNO+"',");
			}
			if (model.JianChaXiangMuID != null)
			{
				strSql1.Append("JianChaXiangMuID,");
				strSql2.Append("'"+model.JianChaXiangMuID+"',");
			}
			if (model.JianChaXiangMuMingCheng != null)
			{
				strSql1.Append("JianChaXiangMuMingCheng,");
				strSql2.Append("'"+model.JianChaXiangMuMingCheng+"',");
			}
			if (model.JianChaBuWeiMingCheng != null)
			{
				strSql1.Append("JianChaBuWeiMingCheng,");
				strSql2.Append("'"+model.JianChaBuWeiMingCheng+"',");
			}
			if (model.JianChaBuWeiBianMa != null)
			{
				strSql1.Append("JianChaBuWeiBianMa,");
				strSql2.Append("'"+model.JianChaBuWeiBianMa+"',");
			}
			if (model.JianChaBuWeiID != null)
			{
				strSql1.Append("JianChaBuWeiID,");
				strSql2.Append("'"+model.JianChaBuWeiID+"',");
			}
			if (model.JianChaFangFaID != null)
			{
				strSql1.Append("JianChaFangFaID,");
				strSql2.Append("'"+model.JianChaFangFaID+"',");
			}
			if (model.JianChaFangFaMingCheng != null)
			{
				strSql1.Append("JianChaFangFaMingCheng,");
				strSql2.Append("'"+model.JianChaFangFaMingCheng+"',");
			}
			if (model.JianChaFangFaBianMa != null)
			{
				strSql1.Append("JianChaFangFaBianMa,");
				strSql2.Append("'"+model.JianChaFangFaBianMa+"',");
			}
			if (model.JianChaLeiXing != null)
			{
				strSql1.Append("JianChaLeiXing,");
				strSql2.Append("'"+model.JianChaLeiXing+"',");
			}
			if (model.JianChaLeiXingNO != null)
			{
				strSql1.Append("JianChaLeiXingNO,");
				strSql2.Append("'"+model.JianChaLeiXingNO+"',");
			}
			if (model.JianChaLeiXingID != null)
			{
				strSql1.Append("JianChaLeiXingID,");
				strSql2.Append("'"+model.JianChaLeiXingID+"',");
			}
			if (model.XiuGaiYiSheng != null)
			{
				strSql1.Append("XiuGaiYiSheng,");
				strSql2.Append("'"+model.XiuGaiYiSheng+"',");
			}
			if (model.XiuGaiYiShengID != null)
			{
				strSql1.Append("XiuGaiYiShengID,");
				strSql2.Append("'"+model.XiuGaiYiShengID+"',");
			}
			if (model.XiuGaiYiShengNO != null)
			{
				strSql1.Append("XiuGaiYiShengNO,");
				strSql2.Append("'"+model.XiuGaiYiShengNO+"',");
			}
			if (model.ShenHeYiShengID != null)
			{
				strSql1.Append("ShenHeYiShengID,");
				strSql2.Append("'"+model.ShenHeYiShengID+"',");
			}
			if (model.ShenHeYiSheng != null)
			{
				strSql1.Append("ShenHeYiSheng,");
				strSql2.Append("'"+model.ShenHeYiSheng+"',");
			}
			if (model.ShenHeYiShengNO != null)
			{
				strSql1.Append("ShenHeYiShengNO,");
				strSql2.Append("'"+model.ShenHeYiShengNO+"',");
			}
			if (model.ShengHeQianMing != null)
			{
				strSql1.Append("ShengHeQianMing,");
				strSql2.Append(""+model.ShengHeQianMing+",");
			}
			if (model.XiuGaiShiJian != null)
			{
				strSql1.Append("XiuGaiShiJian,");
				strSql2.Append("'"+model.XiuGaiShiJian+"',");
			}
			if (model.ShenHeShiJian != null)
			{
				strSql1.Append("ShenHeShiJian,");
				strSql2.Append("'"+model.ShenHeShiJian+"',");
			}
			if (model.DaYinYiSheng != null)
			{
				strSql1.Append("DaYinYiSheng,");
				strSql2.Append("'"+model.DaYinYiSheng+"',");
			}
			if (model.DaYinYiShengID != null)
			{
				strSql1.Append("DaYinYiShengID,");
				strSql2.Append("'"+model.DaYinYiShengID+"',");
			}
			if (model.DaYinYiShengNO != null)
			{
				strSql1.Append("DaYinYiShengNO,");
				strSql2.Append("'"+model.DaYinYiShengNO+"',");
			}
			if (model.DaYinShiJian != null)
			{
				strSql1.Append("DaYinShiJian,");
				strSql2.Append("'"+model.DaYinShiJian+"',");
			}
			if (model.ZhenDuanMiaoShu != null)
			{
				strSql1.Append("ZhenDuanMiaoShu,");
				strSql2.Append("'"+model.ZhenDuanMiaoShu+"',");
			}
			if (model.JianChaMiaoShu != null)
			{
				strSql1.Append("JianChaMiaoShu,");
				strSql2.Append("'"+model.JianChaMiaoShu+"',");
			}
			if (model.ZhenDuan != null)
			{
				strSql1.Append("ZhenDuan,");
				strSql2.Append("'"+model.ZhenDuan+"',");
			}
			if (model.ZhenDuanNO != null)
			{
				strSql1.Append("ZhenDuanNO,");
				strSql2.Append("'"+model.ZhenDuanNO+"',");
			}
			if (model.LinChuangZhenDuan != null)
			{
				strSql1.Append("LinChuangZhenDuan,");
				strSql2.Append("'"+model.LinChuangZhenDuan+"',");
			}
			if (model.LinChuangZhenDuanNO != null)
			{
				strSql1.Append("LinChuangZhenDuanNO,");
				strSql2.Append("'"+model.LinChuangZhenDuanNO+"',");
			}
			if (model.YiShengJianYi != null)
			{
				strSql1.Append("YiShengJianYi,");
				strSql2.Append("'"+model.YiShengJianYi+"',");
			}
			strSql.Append("insert into YW_ReportInfo(");
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Pacs.Model.YW_ReportInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update YW_ReportInfo set ");
			if (model.YX_StudyInfoID != null)
			{
				strSql.Append("YX_StudyInfoID='"+model.YX_StudyInfoID+"',");
			}
			else
			{
				strSql.Append("YX_StudyInfoID= null ,");
			}
			if (model.BaoGaoMingCheng != null)
			{
				strSql.Append("BaoGaoMingCheng='"+model.BaoGaoMingCheng+"',");
			}
			else
			{
				strSql.Append("BaoGaoMingCheng= null ,");
			}
			if (model.YouXiaoShiJian != null)
			{
				strSql.Append("YouXiaoShiJian='"+model.YouXiaoShiJian+"',");
			}
			else
			{
				strSql.Append("YouXiaoShiJian= null ,");
			}
			if (model.TuPianMiaoShu != null)
			{
				strSql.Append("TuPianMiaoShu='"+model.TuPianMiaoShu+"',");
			}
			else
			{
				strSql.Append("TuPianMiaoShu= null ,");
			}
			if (model.JianChaSuoJian != null)
			{
				strSql.Append("JianChaSuoJian='"+model.JianChaSuoJian+"',");
			}
			else
			{
				strSql.Append("JianChaSuoJian= null ,");
			}
			if (model.BaoGaoYiShengID != null)
			{
				strSql.Append("BaoGaoYiShengID='"+model.BaoGaoYiShengID+"',");
			}
			else
			{
				strSql.Append("BaoGaoYiShengID= null ,");
			}
			if (model.BaoGaoYiShengXingMing != null)
			{
				strSql.Append("BaoGaoYiShengXingMing='"+model.BaoGaoYiShengXingMing+"',");
			}
			else
			{
				strSql.Append("BaoGaoYiShengXingMing= null ,");
			}
			if (model.BaoGaoYiShengNO != null)
			{
				strSql.Append("BaoGaoYiShengNO='"+model.BaoGaoYiShengNO+"',");
			}
			else
			{
				strSql.Append("BaoGaoYiShengNO= null ,");
			}
			if (model.BaoGaoYiShengQianMing != null)
			{
				strSql.Append("BaoGaoYiShengQianMing="+model.BaoGaoYiShengQianMing+",");
			}
			else
			{
				strSql.Append("BaoGaoYiShengQianMing= null ,");
			}
			if (model.BaoGaoZhuangTai != null)
			{
				strSql.Append("BaoGaoZhuangTai='"+model.BaoGaoZhuangTai+"',");
			}
			else
			{
				strSql.Append("BaoGaoZhuangTai= null ,");
			}
			if (model.ChuangJianShiJian != null)
			{
				strSql.Append("ChuangJianShiJian='"+model.ChuangJianShiJian+"',");
			}
			else
			{
				strSql.Append("ChuangJianShiJian= null ,");
			}
			if (model.ChuangJianRen != null)
			{
				strSql.Append("ChuangJianRen='"+model.ChuangJianRen+"',");
			}
			else
			{
				strSql.Append("ChuangJianRen= null ,");
			}
			if (model.ChuangJianRenID != null)
			{
				strSql.Append("ChuangJianRenID='"+model.ChuangJianRenID+"',");
			}
			else
			{
				strSql.Append("ChuangJianRenID= null ,");
			}
			if (model.ChuangJianRenNO != null)
			{
				strSql.Append("ChuangJianRenNO='"+model.ChuangJianRenNO+"',");
			}
			else
			{
				strSql.Append("ChuangJianRenNO= null ,");
			}
			if (model.JianChaXiangMuNO != null)
			{
				strSql.Append("JianChaXiangMuNO='"+model.JianChaXiangMuNO+"',");
			}
			else
			{
				strSql.Append("JianChaXiangMuNO= null ,");
			}
			if (model.JianChaXiangMuID != null)
			{
				strSql.Append("JianChaXiangMuID='"+model.JianChaXiangMuID+"',");
			}
			else
			{
				strSql.Append("JianChaXiangMuID= null ,");
			}
			if (model.JianChaXiangMuMingCheng != null)
			{
				strSql.Append("JianChaXiangMuMingCheng='"+model.JianChaXiangMuMingCheng+"',");
			}
			else
			{
				strSql.Append("JianChaXiangMuMingCheng= null ,");
			}
			if (model.JianChaBuWeiMingCheng != null)
			{
				strSql.Append("JianChaBuWeiMingCheng='"+model.JianChaBuWeiMingCheng+"',");
			}
			else
			{
				strSql.Append("JianChaBuWeiMingCheng= null ,");
			}
			if (model.JianChaBuWeiBianMa != null)
			{
				strSql.Append("JianChaBuWeiBianMa='"+model.JianChaBuWeiBianMa+"',");
			}
			else
			{
				strSql.Append("JianChaBuWeiBianMa= null ,");
			}
			if (model.JianChaBuWeiID != null)
			{
				strSql.Append("JianChaBuWeiID='"+model.JianChaBuWeiID+"',");
			}
			else
			{
				strSql.Append("JianChaBuWeiID= null ,");
			}
			if (model.JianChaFangFaID != null)
			{
				strSql.Append("JianChaFangFaID='"+model.JianChaFangFaID+"',");
			}
			else
			{
				strSql.Append("JianChaFangFaID= null ,");
			}
			if (model.JianChaFangFaMingCheng != null)
			{
				strSql.Append("JianChaFangFaMingCheng='"+model.JianChaFangFaMingCheng+"',");
			}
			else
			{
				strSql.Append("JianChaFangFaMingCheng= null ,");
			}
			if (model.JianChaFangFaBianMa != null)
			{
				strSql.Append("JianChaFangFaBianMa='"+model.JianChaFangFaBianMa+"',");
			}
			else
			{
				strSql.Append("JianChaFangFaBianMa= null ,");
			}
			if (model.JianChaLeiXing != null)
			{
				strSql.Append("JianChaLeiXing='"+model.JianChaLeiXing+"',");
			}
			else
			{
				strSql.Append("JianChaLeiXing= null ,");
			}
			if (model.JianChaLeiXingNO != null)
			{
				strSql.Append("JianChaLeiXingNO='"+model.JianChaLeiXingNO+"',");
			}
			else
			{
				strSql.Append("JianChaLeiXingNO= null ,");
			}
			if (model.JianChaLeiXingID != null)
			{
				strSql.Append("JianChaLeiXingID='"+model.JianChaLeiXingID+"',");
			}
			else
			{
				strSql.Append("JianChaLeiXingID= null ,");
			}
			if (model.XiuGaiYiSheng != null)
			{
				strSql.Append("XiuGaiYiSheng='"+model.XiuGaiYiSheng+"',");
			}
			else
			{
				strSql.Append("XiuGaiYiSheng= null ,");
			}
			if (model.XiuGaiYiShengID != null)
			{
				strSql.Append("XiuGaiYiShengID='"+model.XiuGaiYiShengID+"',");
			}
			else
			{
				strSql.Append("XiuGaiYiShengID= null ,");
			}
			if (model.XiuGaiYiShengNO != null)
			{
				strSql.Append("XiuGaiYiShengNO='"+model.XiuGaiYiShengNO+"',");
			}
			else
			{
				strSql.Append("XiuGaiYiShengNO= null ,");
			}
			if (model.ShenHeYiShengID != null)
			{
				strSql.Append("ShenHeYiShengID='"+model.ShenHeYiShengID+"',");
			}
			else
			{
				strSql.Append("ShenHeYiShengID= null ,");
			}
			if (model.ShenHeYiSheng != null)
			{
				strSql.Append("ShenHeYiSheng='"+model.ShenHeYiSheng+"',");
			}
			else
			{
				strSql.Append("ShenHeYiSheng= null ,");
			}
			if (model.ShenHeYiShengNO != null)
			{
				strSql.Append("ShenHeYiShengNO='"+model.ShenHeYiShengNO+"',");
			}
			else
			{
				strSql.Append("ShenHeYiShengNO= null ,");
			}
			if (model.ShengHeQianMing != null)
			{
				strSql.Append("ShengHeQianMing="+model.ShengHeQianMing+",");
			}
			else
			{
				strSql.Append("ShengHeQianMing= null ,");
			}
			if (model.XiuGaiShiJian != null)
			{
				strSql.Append("XiuGaiShiJian='"+model.XiuGaiShiJian+"',");
			}
			else
			{
				strSql.Append("XiuGaiShiJian= null ,");
			}
			if (model.ShenHeShiJian != null)
			{
				strSql.Append("ShenHeShiJian='"+model.ShenHeShiJian+"',");
			}
			else
			{
				strSql.Append("ShenHeShiJian= null ,");
			}
			if (model.DaYinYiSheng != null)
			{
				strSql.Append("DaYinYiSheng='"+model.DaYinYiSheng+"',");
			}
			else
			{
				strSql.Append("DaYinYiSheng= null ,");
			}
			if (model.DaYinYiShengID != null)
			{
				strSql.Append("DaYinYiShengID='"+model.DaYinYiShengID+"',");
			}
			else
			{
				strSql.Append("DaYinYiShengID= null ,");
			}
			if (model.DaYinYiShengNO != null)
			{
				strSql.Append("DaYinYiShengNO='"+model.DaYinYiShengNO+"',");
			}
			else
			{
				strSql.Append("DaYinYiShengNO= null ,");
			}
			if (model.DaYinShiJian != null)
			{
				strSql.Append("DaYinShiJian='"+model.DaYinShiJian+"',");
			}
			else
			{
				strSql.Append("DaYinShiJian= null ,");
			}
			if (model.ZhenDuanMiaoShu != null)
			{
				strSql.Append("ZhenDuanMiaoShu='"+model.ZhenDuanMiaoShu+"',");
			}
			else
			{
				strSql.Append("ZhenDuanMiaoShu= null ,");
			}
			if (model.JianChaMiaoShu != null)
			{
				strSql.Append("JianChaMiaoShu='"+model.JianChaMiaoShu+"',");
			}
			else
			{
				strSql.Append("JianChaMiaoShu= null ,");
			}
			if (model.ZhenDuan != null)
			{
				strSql.Append("ZhenDuan='"+model.ZhenDuan+"',");
			}
			else
			{
				strSql.Append("ZhenDuan= null ,");
			}
			if (model.ZhenDuanNO != null)
			{
				strSql.Append("ZhenDuanNO='"+model.ZhenDuanNO+"',");
			}
			else
			{
				strSql.Append("ZhenDuanNO= null ,");
			}
			if (model.LinChuangZhenDuan != null)
			{
				strSql.Append("LinChuangZhenDuan='"+model.LinChuangZhenDuan+"',");
			}
			else
			{
				strSql.Append("LinChuangZhenDuan= null ,");
			}
			if (model.LinChuangZhenDuanNO != null)
			{
				strSql.Append("LinChuangZhenDuanNO='"+model.LinChuangZhenDuanNO+"',");
			}
			else
			{
				strSql.Append("LinChuangZhenDuanNO= null ,");
			}
			if (model.YiShengJianYi != null)
			{
				strSql.Append("YiShengJianYi='"+model.YiShengJianYi+"',");
			}
			else
			{
				strSql.Append("YiShengJianYi= null ,");
			}
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			strSql.Append(" where ID='"+ model.ID+"' ");
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YW_ReportInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string IDlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YW_ReportInfo ");
			strSql.Append(" where ID in ("+IDlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YW_ReportInfo GetModel(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1  ");
			strSql.Append(" ID,YX_StudyInfoID,BaoGaoMingCheng,YouXiaoShiJian,TuPianMiaoShu,JianChaSuoJian,BaoGaoYiShengID,BaoGaoYiShengXingMing,BaoGaoYiShengNO,BaoGaoYiShengQianMing,BaoGaoZhuangTai,ChuangJianShiJian,ChuangJianRen,ChuangJianRenID,ChuangJianRenNO,JianChaXiangMuNO,JianChaXiangMuID,JianChaXiangMuMingCheng,JianChaBuWeiMingCheng,JianChaBuWeiBianMa,JianChaBuWeiID,JianChaFangFaID,JianChaFangFaMingCheng,JianChaFangFaBianMa,JianChaLeiXing,JianChaLeiXingNO,JianChaLeiXingID,XiuGaiYiSheng,XiuGaiYiShengID,XiuGaiYiShengNO,ShenHeYiShengID,ShenHeYiSheng,ShenHeYiShengNO,ShengHeQianMing,XiuGaiShiJian,ShenHeShiJian,DaYinYiSheng,DaYinYiShengID,DaYinYiShengNO,DaYinShiJian,ZhenDuanMiaoShu,JianChaMiaoShu,ZhenDuan,ZhenDuanNO,LinChuangZhenDuan,LinChuangZhenDuanNO,YiShengJianYi ");
			strSql.Append(" from YW_ReportInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			Pacs.Model.YW_ReportInfo model=new Pacs.Model.YW_ReportInfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YW_ReportInfo DataRowToModel(DataRow row)
		{
			Pacs.Model.YW_ReportInfo model=new Pacs.Model.YW_ReportInfo();
			if (row != null)
			{
				if(row["ID"]!=null)
				{
					model.ID=row["ID"].ToString();
				}
				if(row["YX_StudyInfoID"]!=null)
				{
					model.YX_StudyInfoID=row["YX_StudyInfoID"].ToString();
				}
				if(row["BaoGaoMingCheng"]!=null)
				{
					model.BaoGaoMingCheng=row["BaoGaoMingCheng"].ToString();
				}
				if(row["YouXiaoShiJian"]!=null && row["YouXiaoShiJian"].ToString()!="")
				{
					model.YouXiaoShiJian=DateTime.Parse(row["YouXiaoShiJian"].ToString());
				}
				if(row["TuPianMiaoShu"]!=null)
				{
					model.TuPianMiaoShu=row["TuPianMiaoShu"].ToString();
				}
				if(row["JianChaSuoJian"]!=null)
				{
					model.JianChaSuoJian=row["JianChaSuoJian"].ToString();
				}
				if(row["BaoGaoYiShengID"]!=null)
				{
					model.BaoGaoYiShengID=row["BaoGaoYiShengID"].ToString();
				}
				if(row["BaoGaoYiShengXingMing"]!=null)
				{
					model.BaoGaoYiShengXingMing=row["BaoGaoYiShengXingMing"].ToString();
				}
				if(row["BaoGaoYiShengNO"]!=null)
				{
					model.BaoGaoYiShengNO=row["BaoGaoYiShengNO"].ToString();
				}
				if(row["BaoGaoYiShengQianMing"]!=null && row["BaoGaoYiShengQianMing"].ToString()!="")
				{
					model.BaoGaoYiShengQianMing=(byte[])row["BaoGaoYiShengQianMing"];
				}
				if(row["BaoGaoZhuangTai"]!=null)
				{
					model.BaoGaoZhuangTai=row["BaoGaoZhuangTai"].ToString();
				}
				if(row["ChuangJianShiJian"]!=null && row["ChuangJianShiJian"].ToString()!="")
				{
					model.ChuangJianShiJian=DateTime.Parse(row["ChuangJianShiJian"].ToString());
				}
				if(row["ChuangJianRen"]!=null)
				{
					model.ChuangJianRen=row["ChuangJianRen"].ToString();
				}
				if(row["ChuangJianRenID"]!=null)
				{
					model.ChuangJianRenID=row["ChuangJianRenID"].ToString();
				}
				if(row["ChuangJianRenNO"]!=null)
				{
					model.ChuangJianRenNO=row["ChuangJianRenNO"].ToString();
				}
				if(row["JianChaXiangMuNO"]!=null)
				{
					model.JianChaXiangMuNO=row["JianChaXiangMuNO"].ToString();
				}
				if(row["JianChaXiangMuID"]!=null)
				{
					model.JianChaXiangMuID=row["JianChaXiangMuID"].ToString();
				}
				if(row["JianChaXiangMuMingCheng"]!=null)
				{
					model.JianChaXiangMuMingCheng=row["JianChaXiangMuMingCheng"].ToString();
				}
				if(row["JianChaBuWeiMingCheng"]!=null)
				{
					model.JianChaBuWeiMingCheng=row["JianChaBuWeiMingCheng"].ToString();
				}
				if(row["JianChaBuWeiBianMa"]!=null)
				{
					model.JianChaBuWeiBianMa=row["JianChaBuWeiBianMa"].ToString();
				}
				if(row["JianChaBuWeiID"]!=null)
				{
					model.JianChaBuWeiID=row["JianChaBuWeiID"].ToString();
				}
				if(row["JianChaFangFaID"]!=null)
				{
					model.JianChaFangFaID=row["JianChaFangFaID"].ToString();
				}
				if(row["JianChaFangFaMingCheng"]!=null)
				{
					model.JianChaFangFaMingCheng=row["JianChaFangFaMingCheng"].ToString();
				}
				if(row["JianChaFangFaBianMa"]!=null)
				{
					model.JianChaFangFaBianMa=row["JianChaFangFaBianMa"].ToString();
				}
				if(row["JianChaLeiXing"]!=null)
				{
					model.JianChaLeiXing=row["JianChaLeiXing"].ToString();
				}
				if(row["JianChaLeiXingNO"]!=null)
				{
					model.JianChaLeiXingNO=row["JianChaLeiXingNO"].ToString();
				}
				if(row["JianChaLeiXingID"]!=null)
				{
					model.JianChaLeiXingID=row["JianChaLeiXingID"].ToString();
				}
				if(row["XiuGaiYiSheng"]!=null)
				{
					model.XiuGaiYiSheng=row["XiuGaiYiSheng"].ToString();
				}
				if(row["XiuGaiYiShengID"]!=null)
				{
					model.XiuGaiYiShengID=row["XiuGaiYiShengID"].ToString();
				}
				if(row["XiuGaiYiShengNO"]!=null)
				{
					model.XiuGaiYiShengNO=row["XiuGaiYiShengNO"].ToString();
				}
				if(row["ShenHeYiShengID"]!=null)
				{
					model.ShenHeYiShengID=row["ShenHeYiShengID"].ToString();
				}
				if(row["ShenHeYiSheng"]!=null)
				{
					model.ShenHeYiSheng=row["ShenHeYiSheng"].ToString();
				}
				if(row["ShenHeYiShengNO"]!=null)
				{
					model.ShenHeYiShengNO=row["ShenHeYiShengNO"].ToString();
				}
				if(row["ShengHeQianMing"]!=null && row["ShengHeQianMing"].ToString()!="")
				{
					model.ShengHeQianMing=(byte[])row["ShengHeQianMing"];
				}
				if(row["XiuGaiShiJian"]!=null && row["XiuGaiShiJian"].ToString()!="")
				{
					model.XiuGaiShiJian=DateTime.Parse(row["XiuGaiShiJian"].ToString());
				}
				if(row["ShenHeShiJian"]!=null && row["ShenHeShiJian"].ToString()!="")
				{
					model.ShenHeShiJian=DateTime.Parse(row["ShenHeShiJian"].ToString());
				}
				if(row["DaYinYiSheng"]!=null)
				{
					model.DaYinYiSheng=row["DaYinYiSheng"].ToString();
				}
				if(row["DaYinYiShengID"]!=null)
				{
					model.DaYinYiShengID=row["DaYinYiShengID"].ToString();
				}
				if(row["DaYinYiShengNO"]!=null)
				{
					model.DaYinYiShengNO=row["DaYinYiShengNO"].ToString();
				}
				if(row["DaYinShiJian"]!=null && row["DaYinShiJian"].ToString()!="")
				{
					model.DaYinShiJian=DateTime.Parse(row["DaYinShiJian"].ToString());
				}
				if(row["ZhenDuanMiaoShu"]!=null)
				{
					model.ZhenDuanMiaoShu=row["ZhenDuanMiaoShu"].ToString();
				}
				if(row["JianChaMiaoShu"]!=null)
				{
					model.JianChaMiaoShu=row["JianChaMiaoShu"].ToString();
				}
				if(row["ZhenDuan"]!=null)
				{
					model.ZhenDuan=row["ZhenDuan"].ToString();
				}
				if(row["ZhenDuanNO"]!=null)
				{
					model.ZhenDuanNO=row["ZhenDuanNO"].ToString();
				}
				if(row["LinChuangZhenDuan"]!=null)
				{
					model.LinChuangZhenDuan=row["LinChuangZhenDuan"].ToString();
				}
				if(row["LinChuangZhenDuanNO"]!=null)
				{
					model.LinChuangZhenDuanNO=row["LinChuangZhenDuanNO"].ToString();
				}
				if(row["YiShengJianYi"]!=null)
				{
					model.YiShengJianYi=row["YiShengJianYi"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID,YX_StudyInfoID,BaoGaoMingCheng,YouXiaoShiJian,TuPianMiaoShu,JianChaSuoJian,BaoGaoYiShengID,BaoGaoYiShengXingMing,BaoGaoYiShengNO,BaoGaoYiShengQianMing,BaoGaoZhuangTai,ChuangJianShiJian,ChuangJianRen,ChuangJianRenID,ChuangJianRenNO,JianChaXiangMuNO,JianChaXiangMuID,JianChaXiangMuMingCheng,JianChaBuWeiMingCheng,JianChaBuWeiBianMa,JianChaBuWeiID,JianChaFangFaID,JianChaFangFaMingCheng,JianChaFangFaBianMa,JianChaLeiXing,JianChaLeiXingNO,JianChaLeiXingID,XiuGaiYiSheng,XiuGaiYiShengID,XiuGaiYiShengNO,ShenHeYiShengID,ShenHeYiSheng,ShenHeYiShengNO,ShengHeQianMing,XiuGaiShiJian,ShenHeShiJian,DaYinYiSheng,DaYinYiShengID,DaYinYiShengNO,DaYinShiJian,ZhenDuanMiaoShu,JianChaMiaoShu,ZhenDuan,ZhenDuanNO,LinChuangZhenDuan,LinChuangZhenDuanNO,YiShengJianYi ");
			strSql.Append(" FROM YW_ReportInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ID,YX_StudyInfoID,BaoGaoMingCheng,YouXiaoShiJian,TuPianMiaoShu,JianChaSuoJian,BaoGaoYiShengID,BaoGaoYiShengXingMing,BaoGaoYiShengNO,BaoGaoYiShengQianMing,BaoGaoZhuangTai,ChuangJianShiJian,ChuangJianRen,ChuangJianRenID,ChuangJianRenNO,JianChaXiangMuNO,JianChaXiangMuID,JianChaXiangMuMingCheng,JianChaBuWeiMingCheng,JianChaBuWeiBianMa,JianChaBuWeiID,JianChaFangFaID,JianChaFangFaMingCheng,JianChaFangFaBianMa,JianChaLeiXing,JianChaLeiXingNO,JianChaLeiXingID,XiuGaiYiSheng,XiuGaiYiShengID,XiuGaiYiShengNO,ShenHeYiShengID,ShenHeYiSheng,ShenHeYiShengNO,ShengHeQianMing,XiuGaiShiJian,ShenHeShiJian,DaYinYiSheng,DaYinYiShengID,DaYinYiShengNO,DaYinShiJian,ZhenDuanMiaoShu,JianChaMiaoShu,ZhenDuan,ZhenDuanNO,LinChuangZhenDuan,LinChuangZhenDuanNO,YiShengJianYi ");
			strSql.Append(" FROM YW_ReportInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM YW_ReportInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.ID desc");
			}
			strSql.Append(")AS Row, T.*  from YW_ReportInfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		*/

		#endregion  Method
		#region  MethodEx

		#endregion  MethodEx
	}
}

